package com.whli.jee.oa.controller;

import com.whli.jee.common.share.entity.ResponseBean;
import com.whli.jee.system.entity.SysRole;
import com.whli.jee.system.entity.SysUser;
import com.whli.jee.system.service.ISysRoleService;
import com.whli.jee.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>自定义Activity选择审批人或组</p>
 * @author whli
 * @version 1.0.0
 * @date 2019/6/26 16:21
 */
@RestController
@RequestMapping(value = "/activity/choose")
public class ChooseController {

    @Autowired
    private ISysUserService userService;
    @Autowired
    private ISysRoleService roleService;

    @GetMapping(value = "/listAllRole")
    public ResponseBean listAllRole() throws Exception{
        ResponseBean bean = new ResponseBean();
        List<SysRole> roles = roleService.listAll(new SysRole());
        bean.setCode("0");
        bean.setData(roles);
        return bean;
    }

    @GetMapping(value = "/listAllUser")
    public ResponseBean listAllUser(@PathVariable(value = "id") String id) throws Exception{
        ResponseBean bean = new ResponseBean();
        List<SysUser> users = userService.listAll(new SysUser());
        bean.setCode("0");
        bean.setData(users);
        return bean;
    }
}
